﻿Imports TBCC.UtilityMobile
Public Class ImgControlService

    Public Shared Function GetControls(ByVal pID As String, ByVal imgID As String) As IList(Of ImgControlItem)
        Dim l As IList(Of ImgControlItem)
        l = New List(Of ImgControlItem)

        Dim strSql As String
        strSql = "Select * From tbccImageControls Where ProjectID=?p0 And ImageID=?p1"

        Dim p(1) As MySql.Data.MySqlClient.MySqlParameter
        p(0) = New MySql.Data.MySqlClient.MySqlParameter()
        p(0).ParameterName = "p0" : p(0).Value = pID

        p(1) = New MySql.Data.MySqlClient.MySqlParameter()
        p(1).ParameterName = "p1" : p(1).Value = imgID

        Dim ds As DataSet
        ds = SqlHelper.ExecuteDataset(strSql, p)

        For Each r As DataRow In ds.Tables(0).Rows
            Dim item As New ImgControlItem
            item.ProjectID = pID
            item.Netid = r("Netid")
            item.Refid = r("Refid")
            item.DataType = r("DataType")
            item.PortNo = r("PortNo")
            item.ImageID = imgID
            item.TitleMsg = r("TitleMsg")
            item.TipMsg = r("TipMsg")
            item.UnitMsg = r("UnitMsg")
            item.cLeft = r("cLeft")
            item.cTop = r("cTop")
            item.cWidth = r("cWidth")
            item.cHeight = r("cHeight")

            l.Add(item)
        Next

        Return l
    End Function

End Class
